	#include<stdio.h>
	int main()
	{
		int a,b,c;
		scanf("%d-%d-%d",&a,&b,&c);
		int yy[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
		if((a%100!=0&&a%4==0)||a%400==0)
		{
		yy[1]=29;
		}

		if(c>2)
		{
		c=c-2;
		}
		else
		{
			b=b-1;
			if(b==0)
			{
				b=12;
				a=a-1;	
			}
		
			c=yy[b-1]+c-2;
		}
		printf("%d-%.2d-%.2d",a,b,c);
		return 0;
	}